#include "showinfo.h"
#include "ui_showinfo.h"

showinfo::showinfo(QWidget *parent,user userSelf,QVariantMap pullChatMap) :
    QDialog(parent),
    ui(new Ui::showinfo)
{
    ui->setupUi(this);
    this->userSelf = userSelf;
    //获取信息
    this->pullMap=pullChatMap;//添加聊天信息处理
    //websocket传输代码
    //获取信息
    QMap userMap = pullMap.value("user").toMap();
    //qDebug()<<pullMap;
    //qDebug()<<userMap;
    QString id = userMap.value("id").toString();
    QString name = userMap.value("username").toString();
    QString gender = userMap.value("gender").toString();
    QString birthday = userMap.value("birthday").toString();
    QString email = userMap.value("email").toString();
    QString qq = userMap.value("qq").toString();
    ui->textBrowser_id->append(id);//对话框中添加id
    ui->textBrowser_name->append(name);//对话框中添加name
    ui->textBrowser_gender->append(gender);//对话框中添加name
    ui->textBrowser_birthday->append(birthday);//对话框中添加birthday
    ui->textBrowser_email->append(email);//对话框中添加email
    ui->textBrowser_qq->append(qq);//对话框中添加qq
    connect(ui->send,&QPushButton::clicked,this, &showinfo:: send_clicked);//添加好友
    //connect(ui->clear,&QPushButton::clicked,this, &showinfo:: clear_clicked);//清空
}
void showinfo:: send_clicked()
{
    this->close();
    addfriendsender *ads=new addfriendsender(nullptr,userSelf);
    ads->show();
}
showinfo::~showinfo()
{
    delete ui;
}
